home *** CD-ROM | disk | FTP | other *** search
/ Software 2000 / Software 2000 Volume 1 (Disc 1 of 2).iso / aga / aga167.dms / in.adf / AGA-SOURCECODE / AGA.DPlay.¼.Pixel.Scrolling.s < prev    next >
Encoding:
Text File  |  1994-03-01  |  4.7 KB  |  315 lines

  1.     section Code,Code_c
  2.  
  3.     include    df0:AGA-SourceCode/HardWareEquates
  4.  
  5. start    bset    #1,$bfe001        low pass filter off
  6.  
  7.     move.l    #Playfield.1,d0
  8.     lea    Play.1(pc),a0
  9.  
  10.     bsr    Init.Copper
  11.  
  12.     move.l    #Playfield.2+16*2,d0
  13.     lea    Play.2(pc),a0
  14.  
  15.     bsr    Init.Copper
  16.  
  17.     move.l    4.w,a6
  18.     jsr    -132(a6)        turn off multitasking
  19.  
  20.     lea    $dff000,a6
  21.     move.w    intenar(a6),ints    save system interrupt status
  22.     move.w    #$3fef,intena(a6)
  23.     move.w    #$c010,intena(a6)    enable copper interrupt
  24.  
  25. vpwait    move.l    vposr(a6),d0        get vertical beam position
  26.     and.l    #$1ff00,d0
  27.     lsr.l    #8,d0
  28.     cmp.w    #312,d0            wait for bottom line
  29.     bne.s    vpwait            before disabling sprite DMA
  30.  
  31.     move.w    #$03ff,dmacon(a6)    DMA off
  32.  
  33.     move.l    $14.w,olddbz        division-by-zero exception handler
  34.     move.l    #rteins,$14.w        set to rte instruction
  35.  
  36.  
  37. *
  38. * SET SCREEN SIZE ETC
  39. *
  40.     move.w    #$0610,bplcon0(a6)    initialise screen
  41.     move.w    #$2c81,diwstrt(a6)
  42.     move.w    #$f4c1,diwstop(a6)
  43.     move.w    #$38,ddfstrt(a6)
  44.     move.w    #$d8,ddfstop(a6)
  45.     move.w    #$00,bplcon1(a6)
  46.     move.w    #$24,bplcon2(a6)
  47.     move.w    #40*3-8,bpl1mod(a6)
  48.     move.w    #40*3-8,bpl2mod(a6)
  49.  
  50.  
  51. *
  52. * SET THE NEW COPPER LOCATION
  53. *
  54.     move.l    4.w,a6
  55.     lea    grafname(pc),a1
  56.     moveq    #0,d0
  57.     jsr    -552(a6)        openlibrary
  58.     tst.l    d0
  59.     beq    end
  60.     move.l    d0,gfxbase
  61.     move.l    d0,a6
  62.     jsr    -456(a6)        ownblitter
  63.  
  64.     move.l    gfxbase(pc),a1
  65.     move.l    38(a1),oldcopper
  66.  
  67.  
  68.     lea    $dff000,a6
  69.     move.l    copper1(pc),cop1lch(a6)
  70.     move.w    d0,copjmp1(a6)
  71.     move.w    #$83c0,dmacon(a6)    DMA on (bitplane, copper, blitter)
  72.  
  73.  
  74. *
  75. * INITIALISE LEVEL 3 INTERRUPT
  76. *
  77.  
  78.     move.l    $6c.w,old
  79.     move.l    #level3,$6c.w
  80.  
  81. *****************************************
  82. *        MAIN LOOP        *
  83. *****************************************
  84.  
  85. loop
  86.     clr.w    nextframe
  87. wait    tst.w    nextframe
  88.     beq.s    wait
  89.  
  90.     bsr    Scroll.Planes
  91.  
  92.     btst    #6,$bfe001
  93.     bne.s    loop
  94.  
  95.  
  96.  
  97. *
  98. * EXIT ROUTINE
  99. *
  100.  
  101.  
  102. wait2    btst    #6,dmaconr(a6)        wait for blitter to finish
  103.     bne.s    wait2
  104.  
  105.     move.l    old(pc),$6c.w
  106.  
  107.     move.l    oldcopper(pc),cop1lch(a6)
  108.  
  109.     move.w    #$8030,dmacon(a6)    DMA on (sprite, disk)
  110.     move.w    ints(pc),d0
  111.     ori.w    #$c000,d0        set SET and INTEN bits
  112.     move.w    d0,intena(a6)        restore system interrupt status
  113.  
  114.     move.l    olddbz(pc),$14.w   restore division-by-zero exception handler
  115.  
  116.     move.l    gfxbase(pc),a6
  117.     jsr    -462(a6)        disownblitter
  118.     move.l    gfxbase(pc),a1
  119.     move.l    4.w,a6
  120.     jsr    -414(a6)        closelibrary
  121.  
  122. end    move.l    4.w,a6
  123.     jsr    -138(a6)        turn on multitasking
  124.  
  125.     bclr    #1,$bfe001        low pass filter on
  126.     moveq    #0,d0
  127.     rts
  128.  
  129.  
  130.  
  131. *********************
  132. * LEVEL 3 INTERRUPT *
  133. *********************
  134.  
  135.  
  136. level3    movem.l    d0-d7/a0-a6,-(sp)
  137.     move.w    #$10,intreq(a6)
  138.  
  139.     move.w    #1,nextframe
  140.  
  141.     movem.l    (sp)+,d0-d7/a0-a6
  142. rteins    rte
  143.  
  144.  
  145. *************************************************
  146.  
  147. Scroll.Planes
  148.     move.w    PlayA(pc),d0
  149.  
  150.     tst.w    PlA.Dir
  151.     bmi.s    Check.LeftA
  152.  
  153.     addq.w    #1,d0
  154.     cmp.w    #255,d0
  155.     bne.s    Set.Values
  156.     move.w    #-1,PlA.dir
  157.     bra.s    Set.Values
  158.  
  159. Check.LeftA
  160.     subq.w    #1,d0
  161.     tst.w    d0
  162.     bne.s    Set.Values
  163.     move.w    #1,PlA.dir
  164.  
  165. Set.Values
  166.     move.w    d0,PlayA
  167.     move.w    #255,d3
  168.     sub.w    d0,d3
  169.  
  170.     move.w    d0,d1
  171.     move.w    d1,d2
  172.  
  173.     and.w    #$0003,d0
  174.     and.w    #$003c,d1
  175.     and.w    #$00c0,d2
  176.  
  177.     lsl.w    #8,d0
  178.     lsr.w    #2,d1
  179.     lsl.w    #4,d2
  180.  
  181.     or.w    d2,d0
  182.     or.w    d1,d0
  183.  
  184.     move.w    d3,d4
  185.     move.w    d4,d5
  186.  
  187.     and.w    #$0003,d3
  188.     and.w    #$003c,d4
  189.     and.w    #$00c0,d5
  190.  
  191.     lsl.w    #8,d3
  192.     lsl.w    #4,d3
  193.     lsl.w    #2,d4
  194.     lsl.w    #8,d5
  195.  
  196.     or.w    d5,d0
  197.     or.w    d4,d0
  198.     or.w    d3,d0
  199.  
  200.     move.w    d0,bplcon1(a6)
  201.     rts
  202.  
  203. *************************************************
  204.  
  205.  
  206. init.copper
  207.     moveq    #4-1,d1
  208. next.plane
  209.     move.w    d0,6(a0)        save low word
  210.     swap    d0
  211.     move.w    d0,2(a0)        save high word
  212.     swap    d0
  213.     add.l    #40,d0            next bitplane
  214.     add.w    #16,a0            update pointer to copper list
  215.     dbra    d1,next.plane
  216.     rts
  217.  
  218. ;""""""""""""""""""""""""""""""""""""""""
  219. ;    " THE COPPER LIST "
  220. ;    "                 "
  221. ;    """""""""""""""""""
  222.  
  223. copper.list.1
  224.     dc.w    $106,$0c40
  225.  
  226.     dc.w    $180,$0
  227.     dc.w    $182,$820
  228.     dc.w    $184,$a42
  229.     dc.w    $186,$c60
  230.     dc.w    $188,$e82
  231.     dc.w    $18a,$ea4
  232.     dc.w    $18c,$ec6
  233.     dc.w    $18e,$ee8
  234.     dc.w    $190,$001
  235.     dc.w    $192,$007
  236.     dc.w    $194,$01a
  237.     dc.w    $196,$02e
  238.     dc.w    $198,$46f
  239.     dc.w    $19a,$69f
  240.     dc.w    $19c,$9cf
  241.     dc.w    $19e,$fff
  242.  
  243.     dc.w    $106,$3420
  244.  
  245.     dc.w    $180,$0
  246.     dc.w    $182,$558
  247.     dc.w    $184,$003
  248.     dc.w    $186,$114
  249.     dc.w    $188,$036
  250.     dc.w    $18a,$227
  251.     dc.w    $18c,$321
  252.     dc.w    $18e,$530
  253.     dc.w    $190,$461
  254.     dc.w    $192,$640
  255.     dc.w    $194,$861
  256.     dc.w    $196,$a71
  257.     dc.w    $198,$c93
  258.     dc.w    $19a,$eb4
  259.     dc.w    $19c,$fc5
  260.     dc.w    $19e,$fd9
  261.  
  262. Play.1
  263.     dc.w    bpl1pth,0        8 bitplane display Dual Pf
  264.     dc.w    bpl1ptl,0
  265. Play.2
  266.     dc.w    bpl2pth,0
  267.     dc.w    bpl2ptl,0
  268.     dc.w    bpl3pth,0
  269.     dc.w    bpl3ptl,0
  270.     dc.w    bpl4pth,0
  271.     dc.w    bpl4ptl,0
  272.     dc.w    bpl5pth,0
  273.     dc.w    bpl5ptl,0
  274.     dc.w    bpl6pth,0
  275.     dc.w    bpl6ptl,0
  276.     dc.w    bpl7pth,0
  277.     dc.w    bpl7ptl,0
  278.     dc.w    bpl8pth,0
  279.     dc.w    bpl8ptl,0
  280.  
  281.     dc.w    $01fc,$3
  282.  
  283.     dc.w    $ff01,$fffe
  284.  
  285.     dc.w    intreq,$8010
  286.  
  287.     dc.w    $ffff,$fffe        END
  288.  
  289.  
  290.  
  291. *************
  292. * VARIABLES *
  293. *************
  294.  
  295. PlayA        dc.w    0
  296.  
  297. copper1        dc.l    copper.list.1
  298.  
  299. olddbz        dc.l    0
  300. oldcopper    dc.l    0
  301. gfxbase        dc.l    0
  302. ints        dc.w    0
  303. old        dc.l    0
  304. nextframe    dc.w    0
  305.  
  306. PlA.Dir        dc.w    1
  307.  
  308. grafname    dc.b    'graphics.library',0
  309.         even
  310.  
  311.  
  312. PlayField.1    incbin    binary/PlayField1
  313. PlayField.2    incbin    binary/Tut16
  314.  
  315.